package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.PlanProductVO;
import com.digitalchina.lxnsy.toolkit.FrescoUtil;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2018/8/24 18:10
 * 修改备注：
 * ================================================
 */

public class PhenologicalHolder extends BaseViewHolder<PlanProductVO.ProductStandardBean.PhaseMsgInfosBean> {


    private TextView tvName;
    private SimpleDraweeView sdv;
    private LinearLayout layout;


    public PhenologicalHolder(ViewGroup parent) {
        super(parent, R.layout.item_phenological);
        tvName = $(R.id.tv_name);
        sdv = $(R.id.sdv);
        layout = $(R.id.layout);
    }

    @Override
    public void setData(PlanProductVO.ProductStandardBean.PhaseMsgInfosBean data) {
        super.setData(data);

        tvName.setText(data.getPhaseName() + "");

        if (data.isChecked()) {
            tvName.setTextColor(getContext().getResources().getColor(R.color.app_color));
            layout.setBackgroundResource(R.drawable.shape_app_line);
        } else {
            tvName.setTextColor(getContext().getResources().getColor(R.color.colorFontBlack));
            layout.setBackgroundResource(R.drawable.shape_empty);
        }


        FrescoUtil.showImageForURL(data.getPhasePic() + "_s", sdv);
    }

}
